(defun digits(n)
  (loop for i = n then (floor (/ i 10))
       while (> i 0)
       collect (mod i 10)))

(defun digits-sum(n)
  (loop for i = n then (floor (/ i 10))
       while (> i 0)
       sum (mod i 10)))

(defun probl56()
  (loop for i from 1 to 99 maximize (loop for j from 1 to 99 maximize (digits-sum (expt i j)))))